package cn.edu.jlu.community.app;

import android.app.Activity;
import android.app.Application;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.view.Display;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.avos.avoscloud.AVOSCloud;

import cn.edu.jlu.community.server.AppServer;

public final class GlobalContext extends Application {

    //singleton
    private static GlobalContext sGlobalContext = null;

    private RequestQueue mQueue;

    //image size
    private Activity activity = null;

    private Activity currentActivity = null;

    private DisplayMetrics displayMetrics = null;

    private Handler handler = new Handler();

    @Override
    public void onCreate() {
        super.onCreate();
        sGlobalContext = this;
        mQueue = Volley.newRequestQueue(this);

        AppServer.init(this);
    }

    public static GlobalContext getInstance() {
        return sGlobalContext;
    }

    public static RequestQueue getRequestQueue() {
        return getInstance().mQueue;
    }

    public Handler getUIHandler() {
        return handler;
    }

    public Activity getActivity() {
        return activity;
    }

    public void setActivity(Activity activity) {
        this.activity = activity;
    }

    public Activity getCurrentActivity() {
        return currentActivity;
    }

    public void setCurrentActivity(Activity currentActivity) {
        this.currentActivity = currentActivity;
    }

}


